package com.cg.javafxdemospring.util;

import org.springframework.context.ApplicationContext;

public class SpringBeanUtil {
    private static ApplicationContext applicationContext;
 
    public static ApplicationContext getApplicationContext(){
        return applicationContext;
    }
 
    public static void setApplicationContext(ApplicationContext applicationContext){
        SpringBeanUtil.applicationContext = applicationContext;
    }
 
    public static <T> T getBean(String name){
        return (T)applicationContext.getBean(name);
    }
 
    public static <T> T getBean(Class<T> clazz){
        return applicationContext.getBean(clazz);
    }
}